<!--添加用户表单-->
<div class="tab_edit">
    <form action="{:Url('bank_edit_submit')}" method="post" id="bank_edit_submit">
        <input type="hidden" name="bank_id" value="{$bank_id}"/>
        <table width="100%" class="list">
            <tr>
                <td class="t_r t_left_w">选择银行分类：</td>
                <td class="t_l">{:widget('common/Select/select',array('bank_type_id',array($bank_type_list,"bank_type_id","bank_type_name"),$bank_info['bank_type_id'],true))}</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">银行名称：</td>
                <td class="t_l">{$bank_info['bank_name']}</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">银行图标：</td>
                <td class="t_l">{:widget('common/Images/wos',array('bank_url','credit',$bank_info['bank_url'],false,true))}</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">银行带文字图标：</td>
                <td class="t_l">{:widget('common/Images/wos',array('bank_word_url','credit',$bank_info['bank_word_url'],false,true))}</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">银行概要：</td>
                <td class="t_l">{:widget("common/Input/input",array("bank_outline",$bank_info['bank_outline'],true,false,"width:800px;"))}</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">信用卡发卡率：</td>
                <td class="t_l">{:widget('common/Radio/radio',array('pass_rate','rate',$bank_info['pass_rate'],true))}</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">信用卡优惠力度：</td>
                <td class="t_l">{:widget('common/Radio/radio',array('discount_rate','rate',$bank_info['discount_rate'],true))}</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">信用卡发卡速度：</td>
                <td class="t_l">{:widget('common/Radio/radio',array('send_rate','rate',$bank_info['send_rate'],true))}</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">信用卡批卡速度描述：</td>
                <td class="t_l">{:widget("common/Input/input",array("ratify_velocity",$bank_info['ratify_velocity'],true,false))} 备注：例如3-7天批卡</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">普卡额度范围：</td>
                <td class="t_l">{:widget("common/Input/input",array("general",$bank_info['general'],true,false))} 备注：例如3000-30000</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">金卡额度范围：</td>
                <td class="t_l">{:widget("common/Input/input",array("gold",$bank_info['gold'],true,false))} 备注：例如5000-50000</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">白金额度范围：</td>
                <td class="t_l">{:widget("common/Input/input",array("platinum",$bank_info['platinum'],true,false))} 备注：例如10万以上</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">热线：</td>
                <td class="t_l">{:widget("common/Input/input",array("heat",$bank_info['heat'],true,false))}</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">专线：</td>
                <td class="t_l">{:widget("common/Input/input",array("specially",$bank_info['specially'],true,false))}</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">信用卡进度查询地址(手机端)：</td>
                <td class="t_l">{:widget("common/Input/input",array("credit_schedule_url",$bank_info['credit_schedule_url'],false,false,"width:800px;"))}<font color="red">（包括http或https）</font></td>
            </tr>
            <tr>
                <td class="t_r t_left_w">信用卡进度查询地址(电脑端)：</td>
                <td class="t_l">{:widget("common/Input/input",array("credit_schedule_url_pc",$bank_info['credit_schedule_url_pc'],false,false,"width:800px;"))}<font color="red">（包括http或https）</font></td>
            </tr>
            <tr>
                <td class="t_r t_left_w">是否支持信用卡：</td>
                <td class="t_l">{:widget('common/Radio/radio',array('is_credit','is_credit',$bank_info['is_credit'],true))}</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">是否有房贷：</td>
                <td class="t_l">{:widget('common/Radio/radio',array('is_house','is_yes',$bank_info['is_house'],true))}</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">是否热门：</td>
                <td class="t_l">{:widget('common/Radio/radio',array('is_hot','is_hot',$bank_info['is_hot'],true))}</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">排序：</td>
                <td class="t_l">{:widget("common/Input/input",array("order_by",$bank_info['order_by']))}</td>
            </tr>
            <tr>
                <td class="t_r t_left_w">备注：</td>
                <td class="t_l">
                    {:widget('common/TextArea/text_area',array('remark',$bank_info['remark'],false,false,"width:800px;"))}
                </td>
            </tr>
            <tr>
                <td class="t_r t_left_w"></td>
                <td class="t_l">
                    <div class="btn"><input type="submit" class="but_blue" value="保存信息"></div>
                </td>
            </tr>
        </table>
    </form>
</div>

<!-- JS处理 -->
<script language="javascript">
    $(function() {
        //有效区域
        var area_tpl = {
            getTemplate: function (info) {
                return '' +
                    '<tr class="info">' +
                    '<td><input type="hidden" name="area[]" value="' + info.data + '">' + info.content + '</td>' +
                    '<td>' + info.arr_house_rate_one + '</td>' +
                    '<td>' + info.arr_house_rate_two + '</td>' +
                    '<td>' + info.arr_house_rate_three + '</td>' +
                    '<td><a class="del" href="javascript:void(0);" class="blue"><b>删除</b></a></td>' +
                    '</tr>';
            }
        };

    //添加关联有效区域
    $("a#area_add").click(function(){
        //初期化变量
        var area = $("select[cache='credit_area'] option:selected");
        var province_id = parseInt(area.eq(0).val());
        var province_name = area.eq(0).text();
        var city_id = parseInt(area.eq(1).val());
        var city_name = area.eq(1).text();
        var arr_house_rate_one = $('input[name=arr_house_rate_one]').val();
        var arr_house_rate_two = $('input[name=arr_house_rate_two]').val();
        var arr_house_rate_three = $('input[name=arr_house_rate_three]').val();

        if(arr_house_rate_one <=0){
            alert("请填写首套利率！");
            return false;
        }

        if(arr_house_rate_one <=0){
            alert("请填写二套利率！");
            return false;
        }
        if(arr_house_rate_one <=0){
            alert("请填写三套利率！");
            return false;
        }

        //判断是否数据是否存在
        if(province_id > 0 && city_id > 0 ) {
            //添加到列表中
            $("tr#area_extend").after(area_tpl.getTemplate({
                data: province_id + "," + city_id + "," + arr_house_rate_one + "," + arr_house_rate_two + "," + arr_house_rate_three,
                content: province_name + "、" + city_name,
                arr_house_rate_one:arr_house_rate_one,
                arr_house_rate_two:arr_house_rate_two,
                arr_house_rate_three:arr_house_rate_three
            }));
        }else{
            alert("请选择有效区域的省份及城市！");
        }
    });

        //删除关联有效区域
        $("a.del").live("click",function(){
            //删除多余数据
            $(this).parents("tr.info").remove();
        });
    });

</script>
